package main
import(
	"fmt"
	_"sync"
	_"time"
	"strconv"
)
func main(){
	//wg := sync.WaitGroup{}
	done := make(chan bool)
	workers := 100
	defer close(done)
	worker := func(i int) {
		//wg.Add(i)
		if i%2 == 0{
			done <- true
		}else{
			done <- false
		}
		// 干活干活干活
		fmt.Println("第"+strconv.Itoa(i)+"次干活")
	}
	workSon := func(i int) {
		//defer wg.Done()
		bool := <- done
		fmt.Printf("结束此次任务%d %v\r\n",i,bool)
		// 检查工作成果
	}
	for i := 0; i < workers; i++ {
		go worker(i)
		go workSon(i)
	}
	//wg.Wait()
	fmt.Println("工作结束")

}